package com.mairuide.robot;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mairuide._frame.base.BaseController;
import com.mairuide.agency.service.AgencyService;

@Controller
@RequestMapping("/robot")
public class RobotRulesController extends BaseController {
	
	@Autowired
	private AgencyService agencyService;
	
	/**
	 * 通过请求modulecode 案件类型返回对应的菜单信息
	 * @param requestUrl
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/getMis4CaseIdAndUserId", method = RequestMethod.POST)
	public Object getMenuInfos4CaseIdAndUserId() {
		Map<String, Object> result = new HashMap<String, Object>();
		String caseId = request.getSession().getAttribute("caseId") == null?"":request.getSession().getAttribute("caseId").toString();
		Integer userId = super.getLoginUser().getId();
		/** 通过查询条件查询所有代办账号 **/
		Map<String,Object> whereMap = new HashMap<String,Object>();
		whereMap.put("CASEMANAGE_ID", caseId);
		whereMap.put("STATE", 0);
		List<Map<String, Object>> maps = agencyService.getAgency4WhereMap(whereMap,userId);
		result.put("agencys",maps);
		return result;
	}
}
